#include<bits/stdc++.h>
using namespace std;
long long n,sum;
bool attack[100005],dead[100005];
long long r[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    bool flag=0;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        if(r[i]!=1&&r[i]!=2){
            flag=1;
        }
    }
    if(flag==0){
        int sum1=0,sum2=0;
        for(int i=1;i<=n;i++){
            if(r[i]==1){
                sum1++;
            }
            if(r[i]==1){
                sum2++;
            }
        }
        if(sum1>=sum2){
            cout<<sum1<<endl;
        }
        else{
            cout<<sum2<<endl;
        }
        return 0;
    }
    if(flag==1){
        sort(r+1,r+1+n);
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                if(r[i]<r[j]&&attack[j]!=1){
                    dead[i]=1;
                    attack[j]=1;
                    break;
                }
            }
        }
        for(int i=1;i<=n;i++){
            if(dead[i]!=1){
                sum++;
            }
        }
        cout<<sum<<endl;
        return 0;
    }
return 0;
}
